"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Base;

var _index = _interopRequireDefault(require("../../index"));

var _button = _interopRequireDefault(require("../../../button"));

var _react = _interopRequireDefault(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

function Base() {
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.default, {
    onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
      var confirm;
      return regeneratorRuntime.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              _context.next = 2;
              return _index.default.confirm({
                title: '提示',
                content: '内容',
                onConfirm: function onConfirm() {
                  return new Promise(function (resolve) {
                    setTimeout(function () {
                      resolve();
                    }, 2000);
                  });
                }
              });

            case 2:
              confirm = _context.sent;
              if (confirm) _index.default.hide();

            case 4:
            case "end":
              return _context.stop();
          }
        }
      }, _callee);
    }))
  }, "\u6253\u5F00 dialog"));
}